import PageGenerate from './index/Home.vue'
const TempCompsFunc = require.context('./components/temps', true, /\.vue$/)

const comps = [
  {
    name: 'PageGenerate',
    component: PageGenerate
  }
]

TempCompsFunc.keys().filter(pathName => pathName.endsWith('index.vue')).forEach(key => {
  const component = TempCompsFunc(key).default
  let name = component.name || key.split('/')[key.split('/').length - 2]
  name = name + 'Temp'
  comps.push({ name, component })
})

export default function(Vue) {
  for(let comp of comps) {
    Vue.component(comp.name, comp.component)
  }
}